           package com.java.diagnostics.visualizer.impl.templates;
           
           import com.java.diagnostics.visualizer.impl.factory.LogFactory;
           import java.io.BufferedInputStream;
           import java.io.File;
           import java.io.FileInputStream;
           import java.io.FileNotFoundException;
           import java.io.InputStream;
           import java.text.MessageFormat;
           import java.util.logging.Logger;
           
           public class FileTemplate extends Template
           {
             private static final Logger TRACE = LogFactory.getTrace(FileTemplate.class);
             private static final String TO_STRING_FORMAT = "Template: [{0} ({1})]";
             private File file;
           
             public FileTemplate()
             {
             }
           
             public FileTemplate(File file)
             {
               super(file.getName());
               this.file = file;
               setDescription(file.getAbsolutePath());
             }
           
             protected InputStream getStream()
               throws FileNotFoundException
             {
               InputStream stream = null;
               if (this.file != null)
                 stream = new BufferedInputStream(new FileInputStream(this.file));
               else {
                 TRACE.warning("A template has been constructed with no file.");
               }
               return stream;
             }
           
             public String toString() {
               return MessageFormat.format("Template: [{0} ({1})]", new Object[] { this.name, 
                 this.file });
             }
           
             public String getFile()
             {
               if (this.file != null) {
                 return this.file.getAbsolutePath();
               }
               return null;
             }
           
             public void setFile(String fileName)
             {
               this.file = new File(fileName);
             }
           }

